package contegor.scire.core;

/**
 * Defines the basic behavior of all links in the system.
 * 
 * Links must be also {@link Connectable Connectable} because they can be also root or source to links attached to them.
 * 
 * Every Link belongs to a Connectable, its root or <i>source</i>. In the other side, it has the {@link Id} of an {@link Identifiable}. We call
 * this <i>other side</i> its <i>target</i>.
 * 
 * Links have a <i>flow</i> that is independent from the source or target. It can be from the source to the target (<i>upstream</i>),
 * from the target to the source (<i>downstream</i>), or neutral. 
 * 
 * @version $Revision: 1.7 $
 * @author  Héctor Cirbián Pousa ($Author: hector $)
 */
@Version("$Id: Link.java,v 1.7 2010-02-01 10:55:39 hector Exp $")
public interface Link extends Connectable {

  /**
   * Enumeration to express the flow of the Link.
   * It does not depends on the source or target of the Link.
   */
  public enum Flow {
    /** The Link goes from the source to the target.*/
    DOWNSTREAM,
    /** The Link goes from the target to the source.*/
    UPSTREAM,
    /** The Link has no flow. */
    NONE;
  }
  
  /** Returns the Link's {@link Connectable} source. */
  public Connectable getSource();

  /** Returns this Link root {@link Concept}; The final 'source' of the chain of {@link Link}s to which this belongs. */
  public Concept getFinalSourceConcept();

  /** Returns the {@link Id} that identifies the Link's target. */
  public Id getTarget();

  /** Returns the Link's {@link Flow}. */
  public Flow getFlow();
}
